{%- set ssl_enabled = config.consolesslcertificateref | length > 0 -%}
{{ pillar['headers']['multiline'] -}}
[Unit]
Description=Podman pod-minio.service
Wants=network.target
After=network-online.target
Requires=container-minio-app.service {% if ssl_enabled %}container-minio-proxy.service{% endif %}
Before=container-minio-app.service {% if ssl_enabled %}container-minio-proxy.service{% endif %}

[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=on-failure
TimeoutStopSec=70
ExecStartPre=/bin/rm -f %t/pod-minio.pid %t/pod-minio.pod-id
ExecStartPre=/usr/bin/podman pod create --infra-conmon-pidfile %t/pod-minio.pid --pod-id-file %t/pod-minio.pod-id --name=minio -p {{ config.port }}:9000 -p {{ config.consoleport }}:9001 --replace
ExecStart=/usr/bin/podman pod start --pod-id-file %t/pod-minio.pod-id
ExecStop=/usr/bin/podman pod stop --ignore --pod-id-file %t/pod-minio.pod-id
ExecStopPost=/usr/bin/podman pod rm --ignore -f --pod-id-file %t/pod-minio.pod-id
PIDFile=%t/pod-minio.pid
Type=forking

[Install]
WantedBy=multi-user.target default.target
